Top 10k strings from Interactive BASIC Programming (1985)(Eigen Software)(Tape 2 of 3 Side B).tzx
in <root> / bin / z80 / software / Sinclair Spectrum Collection TOSEC.exe / Sinclair ZX Spectrum - Utilities & Educational / Sinclair ZX Spectrum - Utilities & Educational - [TZX] (TOSEC-v2007-01-01) /
Back to the directory listing
4 THEN GOTO 3 decpos=decpos+1 3 THEN PRINT 3 ;"Press ENTER" 2 current=current+1 2 a$(j)=a$(j+1 2 RANDOMIZE USR 2 PRINT LEN 2 Decimal alignment 2 ;s$(atno): 2 ;"toggle sound: SPACE & ENTER" 2 ;"help: CAPS SHIFT & ENTER"; 2 ;"forward: SYMBOL SHIFT & SPACE"; 2 ;"backward: SYMBOL SHIFT & ENTER"; 2 ;"WARNING: if you enter 2 ;"Loading, please wait!" 2 ;"Interactive BASIC Programming"; 2 ;"Eigen Software"; 2 ;"Copyright 2 -decpos;a$ 2 , it must be followed by 2 (b*b-4*a*c))/(2*a)" 2 "telephone ";a(current,3 2 "name please ";a$(current) 2 "my screen" 2 "month of birthday ";a(current,2 2 "day of month of birthday ";a(current,1 2 "Enter sum ";a$ 2 "Do you have any more friends? (y/n) ";b$ 2 total=total+ 2 the Solution, then 2 THEN LET 2 PRINT TAB 2 1985 Eigen Software" 2 EIGEN SOFTWARE"; 2 create reality" 2 remove ` 1 x 1 will save array 1 will print 1 will load the screen back. So you can design a title screen for your programs and load it in when required. 1 will have his or her birthday stored in 1 which can be thought of as meaning: set up anarray of 1 values of x (x1 and x2) that solve the equation." 1 total=total+ 1 to input the names, birthdays and telephone numbers. 1 then swap their contents. If this process is repeated for allconsecutive pairs of elements then the last element ( 1 th character. An example will show you what this means: 1 th character through to the 1 tangent 1 t$=t$+".00": 1 statements. Then use one or two 1 state-ments to check whether the 1 sign All these functions are followedby a number or variable without brackets or complex expression enclosed in brackets. Find these keywords on the Spectrum keyboard. 1 remove unwanted spaces! 1 prints 84. 1 plug the hole 1 name O.K. by now 1 module h 1 module g 1 means create 1 look at ordered list 1 look at list 1 is required. 1 is negative then 1 i.e. it turns a numeric expression into a string. (N.B. You might have to use brackets). So 1 first 110 1 finds the length of astring, so : 1 f$=a$(i)(1 1 f$;"'s birthday on the ";a(c,1);" of the ";a(i,2)'"telephone number is ";a(i,3) 1 f$;"'s birthday is on the ";a(i,1 1 f$;" not known": 1 elements of an array can be read directly 1 don't worry about this, it's explained in the next Learning Module 1 does the opposite to (inverse of) 1 current=current+1 290 1 contains a string which represents the lastsum entered (` removed remember)We can convert this string to a number using 1 can be used for the two-dimensional numerical array.So the friend whose name is in element 1 but update both arrays. 1 b$=e$(atno) 1 b$(j)=b$(j+1 1 b$(i)=e$ 1 array name() 1 absolute magnitude 1 a(current,1) 1 a$=s$(atno) 1 a$=a$+" ": 1 a$;"'s birthday is on the ";a(i,1);m$(a(i,2)) 1 a$(k);"-;" 145 1 a$(j)=a$(j+1): 1 a$(1)>a$(2) 1 a$ 120 1 You need to generate random (atomic) numbers between 1 and 20 inclusive. Then print out a question that contains either a name or symbol. e.g. 1 Write your own routine for the y-axis divisions. 1 What is the chemical symbol for calcium? 1 Use the program in the last Learning Element but replace y=x*x-3 with: (i) y=x*x*x/8+3 (ii) y=4* 1 This leaves the original letters unchanged (capitals as capitals, lower case as lower case) 1 Study this algorithm. It will place "B" 1 Strip off any trailing spaces 1 Run this program 1 Remember: once you have data stored in an array use 1 RATE=15 110 1 Quadratic Solver 1 Pad with a space if necessary 1 PRINT CODE 1 Note GOTO 90 would reset total to 0 and foil our hopes of a running total! 1 MODULE H 1 MODULE G 1 Look at characters 1 If you then use something like 1 If you know something about modern maths then you can think of two-dimensional arrays as matrices. 1 Hello there 1 Enter and run the program in order to check your ideas. 1 D=b*b-4*a*c 1 Created with Ramsoft MakeTZX 1 BloodOnTheTracks=2 1 BloodOnTheTracks+"And I'm back in the rain" 1 Arrays could be used to great effect in many applications. Storing information for bank accounts, payrolls, libraries, in fact any situation in which data has a precise order. 1 Alphabetical words 1 Alphabetical letters 1 Actual calculation 1 ;a;"x ";b$;" ";b;"x ";c$;" ";c;" = 0"; 1 ;"x2 = (-b- 1 ;"x1 = ";x1; 1 ;"root is no good)" 1 ;"repeat if another equation"; 1 ;"is to be solved" 1 ;"if you think our 8-bit software is astounding, you'll be amazed by our 16-bit software" 1 ;"if a=0 then ask for a again" 1 ;"if D is negative then end"; 1 ;"find x1 and x2" 1 ;"do this ....." 1 ;"display the general formula" 1 ;"calculate D = b*b-4*a*c" 1 ;"c r e a t e r e a l i t y" 1 ;"ax + bx + c = 0" 1 ;"awesome software engineering" 1 ;"ask for b and c" 1 ;"ask for a" 1 ;"and x2 = ";x2 1 ;"_______" 1 ;"Your quadratic equation is:" 1 ;"Wrong. The chemical symbol for ";b$;" is "; 1 ;"What is the chemical symbol for ";b$;"?" 1 ;"These are found from: x1 = (-b+ 1 ;"There is a formula that let's us";#0 1 ;"Sorry, name too long": 1 ;"So 2 5x - 3x + 7 = 0 is a quadratic equation in which a=5, b=-3 and c=7" 1 ;"Remember: 2 ax + bx + c = 0" 1 ;"Look up more friends? (y/n)" 1 ;"Learning Module H" 1 ;"Learning Module G" 1 ;"It has roots:"; 1 ;"Information on a friend:" 1 ;"For quadratic equations a cannotbe 0! Try again.": 1 ;"Finding values for x is called solving the equation" 1 ;"ENTER a(";i;") ": 1 ;"Correct. The chemical symbol for";b$;" is "; 1 ;"Cannot solve this one!": 1 ;"All quadratic equations have 1 ;"A quadratic equation looks like this:"; 1 ;"A quadratic equation looks like this: 2 ax + bx + c = 0 a, b and c are numbers and a 1 ;"(negative square"; 1 ;" " 1 : it gives the character whose code follows it.So 1 : 1 550 530 1 500 550 1 44,44 1 300 220 1 17,6;"-4" 1 17,19;"2" 1 16384,6912 1 161,0 1 16 1 130 150 1 124,4 1 100 1 10 1 0,161 1 0,-5 1 /8+3 y=4cosx 1 /2 radians. So radian measure is just an alternative to degrees. Spectrum expects to be given angles in radians but if you prefer to use degrees then multiplying by 1 . You can thenload the array back in some timelater with 1 . Then print 1 . The tangents lie in a larger range(- 1 . The ordinary variable 1 . Omitting 1 . Modify the algorithm so that it gives equal weight to upper and lower case letters. This will not be easy but persevere. 1 . Just replace 1 . Incidentally, this curve is called a parabola. 1 . (Use two variables 1 . Similarly 1 . If we use 1 . Experiment with 1 . A string always follows 1 . 1 . 1 -decpos;t$;" TOTAL" 1 -3x+2=0 is an example of a quadratic equation where a=1, b=-3 and c=2. If a=0 then the equation is called a linear equation and is nothing like a quadratic equation! 1 -3x+2=0 x=1 will fit since 1 1 -3so when x=4 (or x=-4), y=13. Thelowest value of y is -3 and occurs when x=0. Let an intervalof one on the y scale be represented by 8 pixels. 1 -3We first need to pick an appropriate scale. The Spectrum upper screen is 256 pixels wide and 176 pixels high. Let's take values of x from -4 to +4 with a division of one represented by 16 pixels. y=x 1 -3. We are using values of x from -4 to 4. 16 pixels per horizontal division hence use 1 -3*1+2=0 and so will x=2. The numbers arecalled roots. All quadratic equations have two roots. We really ought to plan the program. 1 -1 120 1 , write an algorithm that inputs a name of max lengtheight characters. An algorithm is a program that performs a specific task and is entirely self contained. Once written, algorithms can be kept for use in later programs. You could build up a library of algorithms 1 , into alphabetical order. This is quite easy but you must concen- trate in order to grasp the principle. First, if 1 , for instance, tells the Spectrum to create an array of 1 , changes its sign to + and places the result in 1 , are called trigonometrical functions. Theirarguments (i.e the values that they act upon) are given in radians. The radian is a unit ofangular measure, as is the degree. A circle is represented by 360 1 +bx+c=0 where a,b and c are numbers. So x 1 ). You will needto put each input in a string variable then check each character of the string for a decimal point. Let the variable 1 )''f$;"'s telephone number is ";a(i,3 1 )'" of the ";a(i,2 1 ) will have the highest code. 1 ) 120 1 (stands for dimension) statement tells the computer that you are going to use an array. 1 (month) and telephone number in 1 (a$(j))>90 1 '. 1 "true" 1 "thirteen"- 1 "tensor " 1 "next a$?";a$(i) 1 "friends" 1 "correct The chemical symbol of ";e$;" is";s$ 1 "a(";i;") contains ";a(i) 1 "You will be surprized at the variety of shapes. To see another shape press any key after hearing the BEEP." 1 "Would you like the total? (y/n) ";b$ 1 "Which friend? ";f$ 510 1 "Which friend? ";f$ 1 "Please ENTER your name ";n$ 1 "Please ENTER c ";c 1 "Please ENTER b ";b 1 "Please ENTER a ";a 1 "Plan for solving quadratic equations:";#0 1 "IF IT GETS BORING THEN BREAK AND RE-RUN TO GET A NEW SEQUENCE" 1 "Hydrogen","Helium","Lithium","Berylium","Boron","Carbon","Nitrigen","Oxygen","Fluorine","Neon","Sodium","Magnesium","Aluminium","Silicon","Phosphorus","Sulphur","Chlorine","Argon","Potassium","Calcium" 1 "How many friends have you got? ";f 110 1 "H","He","Li","Be","B","C","N","O","F","Ne","Na","Mg","Al","Si","P","S","Cl","Ar","K","Ca" 1 "Enter element ";c$ 1 "Do you want to add (enter a) more information"''"or look (enter l) at information" 1 "Do you have any more friends? ",h$ 210 1 "Another equation? (y/n) ";a$ 1 "Another equation (y/n) ";a$ 1 "Abc" < "ACb" 1 "ABC" < "ACB" 1 y=x*x*x/8+3 1 x=-4 TO 4 1 will print 8.What do you think the following program will do? 1 will do? Enter this statement tocheck if you are right. 1 will be needed for10 words. We can compare strings: so 1 true/false?). Discover also, the ordering for upper case letters, lower case letters, the space, question mark, user-defined graphics etc. 1 to your program. Test for negative 1 to store thenames of the first 1 to hold the running total then we must startoff with 1 this allows 1 third 130 1 then the beginning of thestring is taken, so 1 the program found in this Learning Element. 1 takes the value -1 if 1 takes the contents of 1 t(1,1) t(2,1) t(3,1) t(4,1) t(1,2) t(2,2) t(3,2) t(4,2) t(1,3) t(2,3) t(3,3) t(4,3) 1 statements to put arrow heads on the axes and use 1 statements for two-dimensional arrays must be like 1 statement. If the name is too long then askfor the name again. 1 statement of a 1 sixth 160 1 sets up the following'boxes': 1 second 120 1 radians. A right angle is 90 1 q$ 1 prints a `.(See Appendix A of the Spectrum Manual {first table, Chapter 4}) 1 positive. If 1 p$="mongoose" 110 1 now print total. 1 natural(base e)logarithm 1 natural antilogarithm 1 n$ 110 1 mustlie between -1 and +1 since no angle can have a sine outside this range. Similarly for 1 means raise e to the power 1 means make 1 means find the natural (base e) log of 1 means find the angle whosetangent is 1 means find the angle (in radians) whose sine is 1 loop to input name etc 1 loop that counts from 10 down to 1. 1 k 135 1 j) 1 j 150 1 j 1 isnegative, 1 if 1 is used to change a string into a numerical expression (it removes quotes). So 1 is true but 1 is true but 1 is the name ofthe first element of the array, the number 1 is the name of the array. (Spectrum numerical arrays can only have single letters for their names) 1 is printed. What will happen if you enter 1 is positive and0 if 1 is often used in a different context. When saving and loading machine code programs. You can save the screen by typing: 1 is negative then print an appropriate message. 1 is called a subscript. Don't worry about allthe jargon. 1 is already positive then 1 is a number called a subscript. Here is an example ofa numerical array: 1 is 0. 1 is false. Find out whether numbers are less than letters (e.g. 1 is completely different to the array variables. You should never become confused by a situation like this since array variables must always have a subscript in brackets e.g. 1 instruction 1 increment decpos each time 140 1 in fact!). So 1 in order to run it a second time. ( 1 if you leave out 1 i 130 1 i 540 1 i 1 i 1 gives the character code ofthe first character in the string. So 1 fourth 140 1 for the symbols: 1 for temporarily storing 1 fifth 150 1 etc. Assume only letters (characters 65 to 90 and97 to 122) in 1 etc. 1 elements. The elements arecalled 1 elements (the longest being 1 e$=e$+d$ 1 does the opposite of 1 decpos=decpos+1: 1 decpos=0 130 1 decpos)<>"." 1 cosine 1 copies the contents of 1 containing 0 and then add each sum: 1 contain the position ofthe decimal point. If you want all decimal points to lie in column 10, for instance, then use 1 columns and 1 clears the contents of all variables, including arrays!) 1 characterslong) use 1 characters. (The names of string arrays consist of a single letter followed by a dollar symbol ($). 1 can have any value. 1 can also be used to cut up (or slice) strings. When 1 before:it's used in the 1 before "a" since 1 atomicnumber= 1 are also trigonometrical functions 1 arctangent 1 arcsine 1 arccosine 1 appears after a string it means only consider the 1 and is equivalent to 'find theantilog of 1 and hence get a value for 1 and dividing by180 will convert degrees to radians. E.g. to enter 1 and a numerical array is set up by 1 a(f,3) 1 a(10) 1 a(1), a(2), a(3), a(4) 1 a$=s$(atomicnumber) 1 a$="milk and sugar" 110 1 a$="catalogue"(TO 3) 1 a$(j)>a$(j+1) 1 a$(f,12) 120 1 a$(decpos 1 a$(2)="Famous Blue Raincoat" 1 a$(10,12): 1 a$(10,12) 1 a$(10,12) 1 a$(1)="tensor" 1 a$() 1 a$ (j+1)=a$ 140 1 You will have to plot a point at 44,44 then draw a horizontal line 161 pixels long for the x axis. Plot a point at 124,4 and draw a vertical line 161 pixels long for the y axis. 1 You must add 1 You could have set up your arrays using these lines: 1 You can use statements like: 1 You can store strings in string arrays. However, you musttell your Spectrum how long you expect the strings to be. 1 Write the first part of the program. This should display the general quadratic equation and ask for a (don't accept 0),b and c. Then display the equation to be solved. 1 Write the actual word sort-ing part of the program. Compar-ing it with the above and then print the resulting alphabeticallist. 1 Write a program that printsthe characters for codes from 32to 255. 1 Write a program that createsa string array to store names offriends and a two-dimensional numeric array that stores their birthdays (one element for the day, another for the month) and telephone numbers. The program should then fill the arrays withdata. Note: after running the program once use 1 Write a program that acts as a chemical symbol tester. Hint: use 1 Write a program that produces an horizontal x axis 181 pixels long (90 pixels either side of the y axis) and ay axis 161 pixels long (40 pixels below and 120 pixels above the y axis). Origin (whereaxes cross) at (124,44) on the spectrum screen. Label the axes x and y. 1 When comparing strings yourSpectrum actually compares the character codes involved. Hence 1 What can we do with the mathematical functions? Well your Spectrum simply makes number crunching much quicker and more reliable but cannot tell you anything that you couldn't have found out by long hand. However, due to the computer's speed and accuracy weare much more likely to find outwhat expressions look like when plotted on a graph or what the roots of a quadratic equation are like. Simply because the long hand method requires much more work and we are less inclined to spend a day or more doing such work when our computer can do it in a matter of seconds! 1 We've come across 1 We'll look first at graph plotting. Supposing we want to plot y=x 1 We will now produce a program for solving quadratic equations.If you've not heard ofquadratic equations before don'tworry, all will be explained. Quadratic equations look like this: ax 1 We need to understand two more functions before we can go on to the next part. They are 1 We have already seen some ofSpectrum's functions. Here are the rest: 1 We can now plot the curve y=x 1 VAT 1 Use a loop with control variable changing from 32 to 255 1 Two- (and more) dimensional arrays are possible. The elements of these arrays must have two subscripts separated by a comma e.g. 1 Try the following equations on the same axes: y=x 1 To help you understand thealgorithm add: 1 This Learning Module is mainly mathematical. If you are not interested in maths then youcan pass on to Learning Module Hwith a clear conscience. We willnot deal with essential BASIC inthis Learning Module, just mathematical functions. 1 There was no need to use a numerical array (unless you use the month name modification) since the input numbers would not be used for sums (no point in adding two telephone numbers)However, other programs might well need to do sums. A shop keeper might store prices for goods in an array and want to calculate VAT for each item. 1 The solution is very much like the first sort. 1 The problem of solving a quadratic equation involves finding values of x that will fit into the equation. For example, for x 1 The last program could be modified so that it keeps a running total of monies entered and asks whether the user would like the total printing after each sum is entered. Let's see how to write such a program. 1 The following program makes good use of an array. Enter the program and run it then modify it to print out the elements in reverse order. 1 The arrays that we've lookedat so far have been one- dimensional i.e. we can imagine the variable boxes as making up a row e.g. 1 THEN PRINT 1 THEN GOTO 1 THEN GOTO 1 Suppose your program uses anordinary numerical variable called 1 Suppose you write a program that asks for several sums of money in pounds and prints each sum on the screen in a vertical list. If the three inputs were `53.50, `1136.95, and `6.18 you would probably have no trouble in producing `53.50 `1136.95 `6.18 But wouldn't `53.50 `1136.95 `6.18 be much better? Write a programthat tabulates sums in this way.(Assume that each input begins with ` and a decimal point is always to be found somewhere). 1 Suppose you are writing a program that asks for the user'sname so that it can be printed at the same time. Suppose also that at the time of printing thename the display is rather crowded so there is limited roomfor the name. 1 Suppose we have to arrange a series of 10 single letters, held in array 1 Spectrum BASIC allows us to play around with strings by providing special string functions. We'll consider these functions now. 1 Place all the names and symbols in 1 PRINT CODE 1 PRINT CHR$ 1 PRINT AT 1 O.K. so the program producesa dotted line. To remedy this replace the 1 Numerical arrays consist of a group of numerical variables (elements) of the form 1 Number the divisions. For x axis: 1 Now for scales. Draw short lines on both axes to indicate divisions of one. For x-axes use 1 Now for a more sensible program. We'll start by programming the Spectrum to sorta list of strings (anything between quotes) into alphabetical order. If you enter 1 Note that 1 Modify your program so that it asks for and checks the electronic configuration of the element. You could extend the program to include more elements. 1 Modify your algorithm to test for no name (empty string in 1 Look up the character codes in Appendix A {first tableChapter 4}. 1 Let's use the same axes to plot y=11-x 1 Let us now consider words rather than letters. Assume thatthe words are no greater than 12letters in length. Hence 1 Input a name (put it in n$ say) then test its length with 1 In this way the letters canbe sorted into alphabetical order. This procedure should berepeated for the first nine elements, then the first eight and so on. The first pass through the array finds the lastletter of the alphabetical list.The last pass finds the first letter. This process is called aRipple Sort. An example will make things clear. 1 In this Learning Module we'll look at arrays. Suppose wewant to input a list of numbers;each number must be placed in a numerical variable. We could usea program like: 1 In order to use an array you must first tell the Spectrumthat it exists. (Contrast this with the way Spectrum deals withordinary variables.) The 1 Improve this by including friendly messages. 1 If you know about imaginary numbers then modify your programfor complex roots. (These correspond to negative values of 1 Here is an algorithm for sorting array 1 Get rid of the ` sign first( 1 For alphabetical ordering, if we set up a second string array in which all the letters correspond to those in the firststring array but are all lower case (or upper case) then a direct comparison can be made. 1 For 10 friends use 1 Experiment and enjoy yourself with the mathematical capabilities of your Spectrum. 1 Does your program place the decimal point of the total in column 10? If not then compare your program to the one found inthis Learning Element. Modify your program so that it accepts sums in pence as well asin pounds. Assume all such sums are 99p or less and input is a number followed by p. (Hint! Check for ` at the beginn-ing of input string. If absent then assume the last character is a p and remove it. No need tocheck for a decimal point in thecase of pence but remember that the number could be one or two digits long). 1 Complete the whole program by calculating the two roots. Also add a repeat facilty. 1 Complete the program so thata running total can be given when requested. 1 Clearly programs of this ilk can form the basis of a filing or index system. Please, please, please note: computer filing systems are only useful when dealing with large quantities of information. For small quantities you will be farbetter off using a record book or indexing cards! 1 Check the ordering of 1 CURRENT=1 200 1 After the 1 A computer's capacity for number crunching is crucial to the scientific and business worlds. You will doubtless find pure mathmatical uses too. 1 ? Try it and see. 1 60+x*16+4*16,44+y*8 1 17,23;"4" 1 17,10;"-2" 1 100 1 10-decpos;a$ 1 10-decpos;a$ 1 10 520 1 10 1 1/16 1 . . etc. . 1 (the second character of Street is t and thefifth character of Street is e).Enter this print statement. 1 "name please ";a$(current) 230 1 "friend not known! ": 1 "day of month of birthday ";a(current,1) 1 "a(";i;") contains ";a(i) 1 "Television" 1 "Street"(2 1 "SUM*RATE/100" 130 1 "Famous B" 1 "Enter element ";c$ 1 "Enter amount ";SUM 120 1 "Enter a(";i;") ";a(i) 1 sine 1 instead, if you like. 1 for labels x and y. 1 contains 1 You could have an array of month names (FEB-DEC),stored in m$(12,3) and use 1 Write a completely new program for setting up axes. x-axis from -12 to 12 and y-axis from -8 to 8. Then plot y=EXP COSx y=4*ABS(COSx)^COSx y=ASNCOSx y=x*COS(4x)/2+x/4 y=x*SIN(4x)/2 1 Use an input statement toask for a name. Find this name in the array 1 PRINT CHR$ 1 In order to save arrays on tape use: 1 Extend your last program sothat it allows you to "look up" birthdays and telephone numbers. 1 loops to transfer this information to arrays. 1 a$(j+1) 1 This array contains four elements i.e. four variables: 1 using 1 tells the computer to go throughto the end of the string, so 1 statements to check for 1 characters per name. 1 b$(10) 1 where 1 prints 113 and 1 places "6" in 1 first line number, to run a program. 1 INPUT 1 arrays of length 1 TAN 1 NEXT 1 INPUT 1 will print 6 since there are sixcharacters in the string 1 LET 1 If 1 x=0 on our graph is at horizontal pixel 124. So the x-coordinate is plotted at 124+x*16. y=0 on our graph is atthe 44th vertical pixel and eachvertical division is 8 pixels long. Hence the y coordinate is plotted at 44+y*8. Complete yourprogram by adding a curve drawing routine. 1 puts "cat" in 1 DIM a$(10,12) 1 DIM 1 ATN 1 CODE 1 and then used 1 will print goose on the screen. Remember to experiment whenever you see something new! 1 NEXT 1 and so on. This is very long- winded though. Furthermore, we will presumably want to use these variables in a similar waybut will have to write separate lines of BASIC to deal with each. 1 LET 1 so you can study each pass. 1 LET 1 LET 1 INPUT 1 LET 1 will print 14. What do you think 1 FOR 1 g(1), g(2), g(3),...,g(25) 1 PRINT 1 DIM 1 280 1 You can use: 1 100 1 H hydrogen Na sodium He helium Mg magnesium Li lithium Al aluminium Be berylium Si silicon B boron P phosphorus C carbon S sulphur N nitrogen Cl chlorine O oxygen Ar argon F fluorine K potassium Ne neon Ca calcium 1 and 1